using SheLife.Domain.Entities;

namespace SheLife.Domain.Interfaces.Repositories
{
    public interface ICommunityPostRepository : IRepository<CommunityPost>
    {
        Task<IEnumerable<CommunityPost>> GetByUserIdAsync(Guid userId);
        Task<IEnumerable<CommunityPost>> GetByCategoryIdAsync(Guid categoryId);
        Task<IEnumerable<CommunityPost>> GetByTagAsync(string tag);
        Task<IEnumerable<CommunityPost>> GetByStatusAsync(string status);
        Task<IEnumerable<CommunityPost>> GetHotPostsAsync(int count);
        Task<IEnumerable<CommunityPost>> GetLatestPostsAsync(int count);
        Task<IEnumerable<CommunityPost>> SearchByContentAsync(string keyword);
    }

    public interface ICommunityPostCollectionRepository : IRepository<CommunityPostCollection>
    {
        Task<IEnumerable<CommunityPostCollection>> GetByUserIdAsync(Guid userId);
        Task<IEnumerable<CommunityPostCollection>> GetByPostIdAsync(Guid postId);
        Task<bool> IsUserCollectedAsync(Guid userId, Guid postId);
    }

    public interface ICommunityCategoryRepository : IRepository<CommunityCategory>
    {
        Task<IEnumerable<CommunityCategory>> GetByParentIdAsync(Guid? parentId);
        Task<IEnumerable<CommunityCategory>> GetActiveCategoriesAsync();
        Task<CommunityCategory> GetByCodeAsync(string code);
    }

    public interface ICommunityTagRepository : IRepository<CommunityTag>
    {
        Task<IEnumerable<CommunityTag>> GetByCategoryIdAsync(Guid categoryId);
        Task<IEnumerable<CommunityTag>> GetHotTagsAsync(int count);
        Task<CommunityTag> GetByNameAsync(string name);
    }

    public interface IUserFriendRepository : IRepository<UserFriend>
    {
        Task<IEnumerable<UserFriend>> GetByUserIdAsync(Guid userId);
        Task<IEnumerable<UserFriend>> GetByFriendIdAsync(Guid friendId);
        Task<bool> IsUserFriendExistsAsync(Guid userId, Guid friendId);
        Task<UserFriend> GetByUserIdAndFriendIdAsync(Guid userId, Guid friendId);
    }

    public interface IUserFollowRepository : IRepository<UserFollow>
    {
        Task<IEnumerable<UserFollow>> GetByUserIdAsync(Guid userId);
        Task<IEnumerable<UserFollow>> GetByFollowedUserIdAsync(Guid followedUserId);
        Task<bool> IsUserFollowedAsync(Guid userId, Guid followedUserId);
        Task<UserFollow> GetByUserIdAndFollowedUserIdAsync(Guid userId, Guid followedUserId);
    }

    public interface IUserMessageRepository : IRepository<UserMessage>
    {
        Task<IEnumerable<UserMessage>> GetBySenderIdAsync(Guid senderId);
        Task<IEnumerable<UserMessage>> GetByReceiverIdAsync(Guid receiverId);
        Task<IEnumerable<UserMessage>> GetConversationAsync(Guid userId1, Guid userId2);
        Task<IEnumerable<UserMessage>> GetUnreadMessagesByReceiverIdAsync(Guid receiverId);
        Task<int> GetUnreadCountByReceiverIdAsync(Guid receiverId);
    }

    public interface IUserGroupRepository : IRepository<UserGroup>
    {
        Task<IEnumerable<UserGroup>> GetByCategoryIdAsync(Guid categoryId);
        Task<IEnumerable<UserGroup>> GetByCreatorIdAsync(Guid creatorId);
        Task<IEnumerable<UserGroup>> GetByStatusAsync(string status);
        Task<IEnumerable<UserGroup>> SearchByNameAsync(string keyword);
    }

    public interface IUserGroupMemberRepository : IRepository<UserGroupMember>
    {
        Task<IEnumerable<UserGroupMember>> GetByGroupIdAsync(Guid groupId);
        Task<IEnumerable<UserGroupMember>> GetByUserIdAsync(Guid userId);
        Task<IEnumerable<UserGroupMember>> GetByGroupIdAndRoleAsync(Guid groupId, string role);
        Task<bool> IsUserMemberOfGroupAsync(Guid userId, Guid groupId);
        Task<UserGroupMember> GetByUserIdAndGroupIdAsync(Guid userId, Guid groupId);
    }

    public interface IUserGroupPostRepository : IRepository<UserGroupPost>
    {
        Task<IEnumerable<UserGroupPost>> GetByGroupIdAsync(Guid groupId);
        Task<IEnumerable<UserGroupPost>> GetByUserIdAsync(Guid userId);
        Task<IEnumerable<UserGroupPost>> GetByGroupIdOrderByCreatedTimeAsync(Guid groupId);
    }
}